<template>
  <el-dialog title="检索" :visible.sync="storehouseSearch" width="50%" center>
    <el-form :model="form">
      <el-form-item label="库位名称" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="仓库名称" :label-width="formLabelWidth" prop="warehouseId">
        <el-select v-model="form.warehouseId" placeholder="请选择仓库名称" clearable>
          <el-option
            v-for="item in warehouseList"
            :key="item.id"
            :label="item.warehouse_name"
            :value="item.id"
          />
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="storehouseSearch = false">取 消</el-button>
      <el-button type="primary" @click="searchFun">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    warehouseList: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
      form: {
        name: '',
        warehouseId: ''
      },
      storehouseSearch: false,
      formLabelWidth: '80px'
    }
  },
  methods: {
    searchFun() {
      console.log(1)
      this.storehouseSearch = false
      console.log(2)
      this.$emit('searchFun', this.form)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
